package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.SmsCouponProductRelation;
import com.itheima.mapper.SmsCouponProductRelationMapper;
import com.itheima.service.db.SmsCouponProductRelationService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class SmsCouponProductRelationServiceImpl implements SmsCouponProductRelationService {

    @Autowired
    SmsCouponProductRelationMapper smsCouponProductRelationMapper;

    @Override
    public List<SmsCouponProductRelation> findByCouponId(Long couponId) {
        LambdaQueryWrapper<SmsCouponProductRelation> qw = new LambdaQueryWrapper<>();

        qw.eq(SmsCouponProductRelation::getCouponId,couponId);

        return smsCouponProductRelationMapper.selectList(qw);
    }

    @Override
    public void save(SmsCouponProductRelation smsCouponProductRelation) {
        smsCouponProductRelationMapper.insert(smsCouponProductRelation);
    }
}
